package com.huangpuweb.task.service.imp;

import com.huangpuweb.task.model.*;
import com.huangpuweb.task.service.SyncQzJGWDataService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SyncQzJGWDataServiceImp extends BaseGafjDataServiceImp implements SyncQzJGWDataService {


    @Override
    public List<QzJGWPARKData> getListQzJGWPARKData() {
        String sql = "select PARKID,PARKNAME,TOTNUM,ADDR from hp_public_park";
        return getEntryList(sql,new QzJGWPARKDataRowMapper(),new Object[]{});
    }

    @Override
    public QzJGWPARKInfoData getListQzJGWPARKInfoData(String parkid) {
        String sql = "select PARKID,TOTAL_LEFT,SENDTIME from hp_public_park_realtime where PARKID=?";
        return getEntry(sql,new QzJGWPARKInfoDataRowMapper(),new Object[]{parkid});
    }

    @Override
    public int getListBuildingAllCount() {

        String sql="select count(id) from ba1011000001 ";
        return queryInteger(sql, new Object[] {});
    }

    @Override
    public List<QzSysBuildingInfo> getListBuildingByPage(int page, int pagecount) {
        String sql="select * from ba1011000001 order by jhpt_update_time asc  limit ? offset ?";
        return getEntryList(sql, new QzSysBuildingInfoRowMapper(), new Object[] {pagecount,(page - 1) * pagecount});
    }

    @Override
    public int getListEmergencyEventAllCount() {
        String sql="select count(id) from ba1011000001 ";
        return queryInteger(sql, new Object[] {});
    }
}
